home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / JWindow.java < prev    next >
Text File  |  1998-06-30  |  24KB  |  752 lines

  1. /*
  2.  * @(#)JWindow.java    1.19 98/04/03
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20. package com.sun.java.swing;
  21.  
  22. import java.awt.*;
  23. import java.awt.event.*;
  24. import java.beans.PropertyChangeListener;
  25. import java.util.Locale;
  26. import java.util.Vector;
  27. import java.io.Serializable;
  28.  
  29. import com.sun.java.accessibility.*;
  30.  
  31. /** 
  32.  * A JWindow is a container that can be displayed anywhere on the
  33.  * user's desktop. It does not have the title bar, window-management buttons,
  34.  * or other trimmings associated with a JFrame, but it is still a 
  35.  * "first-class citizen" of the user's desktop, and can exist anywhere
  36.  * on it.
  37.  * <p>
  38.  * The JWindow component contains a JRootPane as it's only child.
  39.  * The contentPane() should be the parent of any children of the JWindow.
  40.  * From the older java.awt.Window object you would normally do something like this:<PRE>
  41.  *       window.add(child);
  42.  * </PRE>
  43.  * However, using JWindow you would code:<PRE>
  44.  *       window.getContentPane().add(child);
  45.  * </PRE>
  46.  * The same is true of setting LayoutManagers, removing components,
  47.  * listing children, etc. All these methods should normally be sent to
  48.  * the contentPane() instead of the JWindow itself. The contentPane() will
  49.  * always be non-null. Attempting to set it to null will cause the JWindow
  50.  * to throw an exception. The default contentPane() will have a BorderLayout
  51.  * manager set on it. 
  52.  * <p>
  53.  * Please see the JRootPane documentation for a complete description of
  54.  * the contentPane(), glassPane(), and layeredPane() components.
  55.  * <p>
  56.  * For the keyboard keys used by this component in the standard Look and
  57.  * Feel (L&F) renditions, see the
  58.  * <a href="doc-files/Key-Index.html#JWindow">JWindow</a> key assignments.
  59.  * <p>
  60.  * Warning: serialized objects of this class will not be compatible with
  61.  * future swing releases.  The current serialization support is appropriate
  62.  * for short term storage or RMI between Swing1.0 applications.  It will
  63.  * not be possible to load serialized Swing1.0 objects with future releases
  64.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  65.  * baseline for the serialized form of Swing objects.
  66.  *
  67.  * @see JRootPane
  68.  *
  69.  * @beaninfo
  70.  *      attribute: isContainer true
  71.  *      attribute: containerDelegate getContentPane
  72.  *    description: A toplevel window which has no system border or controls.
  73.  *
  74.  * @version 1.19 04/03/98
  75.  * @author David Kloba
  76.  */
  77. public class JWindow extends Window implements Accessible, RootPaneContainer 
  78. {
  79.     /**
  80.      * The JRootPane instance that manages the <code>contentPane</code> 
  81.      * and optional <code>menuBar</code> for this frame, as well as the 
  82.      * <code>glassPane</code>.
  83.      *
  84.      * @see #getRootPane
  85.      * @see #setRootPane
  86.      */
  87.     protected JRootPane rootPane;
  88.  
  89.     /**
  90.      * If true then calls to <code>add</code> and <code>setLayout</code>
  91.      * cause an exception to be thrown.
  92.      *
  93.      * @see #isRootPaneCheckingEnabled
  94.      * @see #setRootPaneCheckingEnabled
  95.      */
  96.     protected boolean rootPaneCheckingEnabled = false;
  97.  
  98.  
  99.     /**
  100.      * Creates a window with no specified owner.
  101.      */
  102.     public JWindow() {
  103.         this(null);
  104.     }
  105.  
  106.     /**
  107.      * Creates a window with the specified owner frame.
  108.      *
  109.      * @param owner the frame from which the window is displayed
  110.      */
  111.     public JWindow(Frame owner) {
  112.         super(owner == null? SwingUtilities.getSharedOwnerFrame() : owner);     
  113.         windowInit();
  114.     }
  115.  
  116.     /** Called by the constructors to init the JWindow properly. */
  117.     protected void windowInit() {
  118.         setRootPane(createRootPane());
  119.         setRootPaneCheckingEnabled(true);
  120.     }
  121.  
  122.     /** Called by the constructor methods to create the default rootPane. */
  123.     protected JRootPane createRootPane() {
  124.         return new JRootPane();
  125.     }
  126.  
  127.     /**
  128.      * Returns whether calls to <code>add</code> and 
  129.      * <code>setLayout</code> cause an exception to be thrown. 
  130.      *
  131.      * @return true if <code>add</code> and <code>setLayout</code> 
  132.      *         are checked
  133.      *
  134.      * @see #addImpl
  135.      * @see #setLayout
  136.      * @see #setRootPaneCheckingEnabled
  137.      */
  138.     protected boolean isRootPaneCheckingEnabled() {
  139.         return rootPaneCheckingEnabled;
  140.     }
  141.  
  142.  
  143.     /**
  144.      * Determines whether calls to <code>add</code> and 
  145.      * <code>setLayout</code> cause an exception to be thrown. 
  146.      * 
  147.      * @param enabled  a boolean value, true if checking is to be
  148.      *        enabled, which cause the exceptions to be thrown
  149.      *
  150.      * @see #addImpl
  151.      * @see #setLayout
  152.      * @see #isRootPaneCheckingEnabled
  153.      * @beaninfo
  154.      *      hidden: true
  155.      * description: Whether the add and setLayout methods throw exceptions when invoked.
  156.      */
  157.     protected void setRootPaneCheckingEnabled(boolean enabled) {
  158.         rootPaneCheckingEnabled = enabled;
  159.     }
  160.  
  161.  
  162.     /**
  163.      * Creates a runtime exception with a message like:
  164.      * <pre>
  165.      * "Do not use JWindow.add() use JWindow.getContentPane().add() instead"
  166.      * </pre>
  167.      *
  168.      * @param op  a String indicating the attempted operation. In the
  169.      *            example above, the operation string is "add"
  170.      */
  171.     private Error createRootPaneException(String op) {
  172.         String type = getClass().getName();
  173.         return new Error(
  174.             "Do not use " + type + "." + op + "() use " 
  175.                           + type + ".getContentPane()." + op + "() instead");
  176.     }
  177.  
  178.  
  179.     /**
  180.      * By default, children may not be added directly to a this component,
  181.      * they must be added to its contentPane instead.  For example:
  182.      * <pre>
  183.      * thisComponent.getContentPane().add(child)
  184.      * </pre>
  185.      * An attempt to add to directly to this component will cause an
  186.      * runtime exception to be thrown.  Subclasses can disable this
  187.      * behavior.
  188.      * 
  189.      * @see #setRootPaneCheckingEnabled
  190.      * @exception Error if called with rootPaneChecking true
  191.      */
  192.     protected void addImpl(Component comp, Object constraints, int index) 
  193.     {
  194.         if(isRootPaneCheckingEnabled()) {
  195.             throw createRootPaneException("add");
  196.         }
  197.         else {
  198.             super.addImpl(comp, constraints, index);
  199.         }
  200.     }
  201.  
  202.  
  203.     /**
  204.      * By default the layout of this component may not be set,
  205.      * the layout of its contentPane should be set instead.  
  206.      * For example:
  207.      * <pre>
  208.      * thisComponent.getContentPane().setLayout(new BorderLayout())
  209.      * </pre>
  210.      * An attempt to set the layout of this component will cause an
  211.      * runtime exception to be thrown.  Subclasses can disable this
  212.      * behavior.
  213.      * 
  214.      * @see #setRootPaneCheckingEnabled
  215.      * @exception Error if called with rootPaneChecking true
  216.      */
  217.     public void setLayout(LayoutManager manager) {
  218.         if(isRootPaneCheckingEnabled()) {
  219.             throw createRootPaneException("setLayout");
  220.         }
  221.         else {
  222.             super.setLayout(manager);
  223.         }
  224.     }
  225.  
  226.  
  227.     /**
  228.      * Returns the rootPane object for this window.
  229.      *
  230.      * @see #setRootPane
  231.      * @see RootPaneContainer#getRootPane
  232.      */
  233.     public JRootPane getRootPane() { 
  234.         return rootPane; 
  235.     }
  236.  
  237.  
  238.     /**
  239.      * Sets the rootPane property.  This method is called by the constructor.
  240.      *
  241.      * @param root the rootPane object for this window
  242.      * @see #getRootPane
  243.      *
  244.      * @beaninfo
  245.      *        hidden: true
  246.      *   description: the RootPane object for this window.
  247.      */
  248.     protected void setRootPane(JRootPane root) {
  249.         if(rootPane != null) {
  250.             remove(rootPane);
  251.         }
  252.         rootPane = root;
  253.         if(rootPane != null) {
  254.             boolean checkingEnabled = isRootPaneCheckingEnabled();
  255.             try {
  256.                 setRootPaneCheckingEnabled(false);
  257.                 add(rootPane, BorderLayout.CENTER);
  258.             }
  259.             finally {
  260.                 setRootPaneCheckingEnabled(checkingEnabled);
  261.             }
  262.         }
  263.     }
  264.  
  265.  
  266.     /**
  267.      * Returns the contentPane object for this window.
  268.      *
  269.      * @return the Container which is the contentPane
  270.      * @see #setContentPane
  271.      * @see RootPaneContainer#getContentPane
  272.      */
  273.     public Container getContentPane() { 
  274.         return getRootPane().getContentPane(); 
  275.     }
  276.  
  277.     /**
  278.      * Sets the contentPane property.  This method is called by the constructor.
  279.      * @param contentPane the contentPane object for this window
  280.      *
  281.      * @exception java.awt.IllegalComponentStateException (a runtime
  282.      *            exception) if the content pane parameter is null
  283.      * @see #getContentPane
  284.      * @see RootPaneContainer#setContentPane
  285.      *
  286.      * @beaninfo
  287.      *     hidden: true
  288.      *     description: The client area of the window where child 
  289.      *                  components are normally inserted.
  290.      */
  291.     public void setContentPane(Container contentPane) {
  292.         getRootPane().setContentPane(contentPane);
  293.     }
  294.  
  295.     /**
  296.      * Returns the layeredPane object for this window.
  297.      *
  298.      * @return the JLayeredPane object
  299.      * @see #setLayeredPane
  300.      * @see RootPaneContainer#getLayeredPane
  301.      */
  302.     public JLayeredPane getLayeredPane() { 
  303.         return getRootPane().getLayeredPane(); 
  304.     }
  305.  
  306.     /**
  307.      * Sets the layeredPane property.  This method is called by the constructor.
  308.      * @param layeredPane the layeredPane object for this window
  309.      *
  310.      * @exception java.awt.IllegalComponentStateException (a runtime
  311.      *            exception) if the content pane parameter is null
  312.      * @see #getLayeredPane
  313.      * @see RootPaneContainer#setLayeredPane
  314.      *
  315.      * @beaninfo
  316.      *     hidden: true
  317.      *     description: The pane which holds the various window layers.
  318.      */
  319.     public void setLayeredPane(JLayeredPane layeredPane) {
  320.         getRootPane().setLayeredPane(layeredPane);
  321.     }
  322.  
  323.     /**
  324.      * Returns the glassPane object for this window.
  325.      *
  326.      * @return the Component which is the glassPane
  327.      * @see #setGlassPane
  328.      * @see RootPaneContainer#getGlassPane
  329.      */
  330.     public Component getGlassPane() { 
  331.         return getRootPane().getGlassPane(); 
  332.     }
  333.  
  334.     /**
  335.      * Sets the glassPane property. 
  336.      * This method is called by the constructor.
  337.      * @param glassPane the glassPane object for this window
  338.      *
  339.      * @see #getGlassPane
  340.      * @see RootPaneContainer#setGlassPane
  341.      *
  342.      * @beaninfo
  343.      *     hidden: true
  344.      *     description: A transparent pane used for menu rendering.
  345.      */
  346.     public void setGlassPane(Component glassPane) {
  347.         getRootPane().setGlassPane(glassPane);
  348.     }
  349.  
  350.  
  351. /////////////////
  352. // Accessibility support
  353. ////////////////
  354.  
  355.     /** The accessible context property */
  356.     protected AccessibleContext accessibleContext = null;
  357.  
  358.     /**
  359.      * Get the AccessibleContext associated with this JWindow
  360.      *
  361.      * @return the AccessibleContext of this JWindow
  362.      */
  363.     public AccessibleContext getAccessibleContext() {
  364.         if (accessibleContext == null) {
  365.             accessibleContext = new AccessibleJWindow();
  366.         }
  367.         return accessibleContext;
  368.     }
  369.  
  370.     /**
  371.      * The class used to obtain the AccessibleRole for this object.
  372.      */
  373.     protected class AccessibleJWindow extends AccessibleContext
  374.         implements Serializable, AccessibleComponent {
  375.  
  376.         // AccessibleContext methods
  377.         //
  378.         /**
  379.          * Get the role of this object.
  380.          *
  381.          * @return an instance of AccessibleRole describing the role of the 
  382.          * object
  383.          * @see AccessibleRole
  384.          */
  385.         public AccessibleRole getAccessibleRole() {
  386.             return AccessibleRole.WINDOW;
  387.         }
  388.  
  389.         /**
  390.          * Get the state of this object.
  391.          *
  392.          * @return an instance of AccessibleStateSet containing the current 
  393.          * state set of the object
  394.          * @see AccessibleState
  395.          */
  396.         public AccessibleStateSet getAccessibleStateSet() {
  397.             AccessibleStateSet states = SwingUtilities.getAccessibleStateSet(JWindow.this);
  398.             if (getFocusOwner() != null) {
  399.                 states.add(AccessibleState.ACTIVE);
  400.             }
  401.             return states;
  402.         }
  403.  
  404.         /**
  405.          * Get the Accessible parent of this object.  If the parent of this
  406.          * object implements Accessible, this method should simply return
  407.          * getParent().
  408.          *
  409.          * @return the Accessible parent of this object -- can be null if this
  410.          * object does not have an Accessible parent
  411.          */
  412.         public Accessible getAccessibleParent() {
  413.             Container parent = getParent();
  414.             if (parent instanceof Accessible) {
  415.                 return (Accessible) parent;
  416.             } else {
  417.                 return null;
  418.             }
  419.         }
  420.  
  421.         /**
  422.          * Get the index of this object in its accessible parent. 
  423.          *
  424.          * @return the index of this object in its parent; -1 if this 
  425.          * object does not have an accessible parent.
  426.          * @see #getAccessibleParent
  427.          */
  428.         public int getAccessibleIndexInParent() {
  429.             return SwingUtilities.getAccessibleIndexInParent(JWindow.this);
  430.         }
  431.  
  432.         /**
  433.          * Returns the number of accessible children in the object.  If all
  434.          * of the children of this object implement Accessible, than this
  435.          * method should return the number of children of this object.
  436.          *
  437.          * @return the number of accessible children in the object.
  438.          */
  439.         public int getAccessibleChildrenCount() {
  440.             return SwingUtilities.getAccessibleChildrenCount(JWindow.this);
  441.         }
  442.  
  443.         /**
  444.          * Return the nth Accessible child of the object.  
  445.          *
  446.          * @param i zero-based index of child
  447.          * @return the nth Accessible child of the object
  448.          */
  449.         public Accessible getAccessibleChild(int i) {
  450.             return SwingUtilities.getAccessibleChild(JWindow.this,i);
  451.         }
  452.  
  453.         /**
  454.          * Return the locale of this object.
  455.          *
  456.          * @return the locale of this object
  457.          */
  458.         public Locale getLocale() {
  459.             return JWindow.this.getLocale();
  460.         }
  461.  
  462.         /**
  463.          * Get the AccessibleComponent associated with this object if one
  464.          * exists.  Otherwise return null.
  465.          */
  466.         public AccessibleComponent getAccessibleComponent() {
  467.             return this;
  468.         }
  469.  
  470.  
  471.         // AccessibleComponent methods
  472.         //
  473.         /**
  474.          * Get the background color of this object.
  475.          *
  476.          * @return the background color, if supported, of the object; 
  477.          * otherwise, null
  478.          */
  479.         public Color getBackground() {
  480.             return JWindow.this.getBackground();
  481.         }
  482.  
  483.         /**
  484.          * Set the background color of this object.
  485.          *
  486.          * @param c the new Color for the background
  487.          */
  488.         public void setBackground(Color c) {
  489.             JWindow.this.setBackground(c);
  490.         }
  491.  
  492.         /**
  493.          * Get the foreground color of this object.
  494.          *
  495.          * @return the foreground color, if supported, of the object; 
  496.          * otherwise, null
  497.          */
  498.         public Color getForeground() {
  499.             return JWindow.this.getForeground();
  500.         }
  501.  
  502.         /**
  503.          * Set the foreground color of this object.
  504.          *
  505.          * @param c the new Color for the foreground
  506.          */
  507.         public void setForeground(Color c) {
  508.             JWindow.this.setForeground(c);
  509.         }
  510.  
  511.         /**
  512.          * Get the Cursor of this object.
  513.          *
  514.          * @return the Cursor, if supported, of the object; otherwise, null
  515.          */
  516.         public Cursor getCursor() {
  517.             return JWindow.this.getCursor();
  518.         }
  519.  
  520.         /**
  521.          * Set the Cursor of this object.
  522.          *
  523.          * @param c the new Cursor for the object
  524.          */
  525.         public void setCursor(Cursor cursor) {
  526.             JWindow.this.setCursor(cursor);
  527.         }
  528.  
  529.         /**
  530.          * Get the Font of this object.
  531.          *
  532.          * @return the Font,if supported, for the object; otherwise, null
  533.          */
  534.         public Font getFont() {
  535.             return JWindow.this.getFont();
  536.         }
  537.  
  538.         /**
  539.          * Set the Font of this object.
  540.          *
  541.          * @param f the new Font for the object
  542.          */
  543.         public void setFont(Font f) {
  544.             JWindow.this.setFont(f);
  545.         }
  546.  
  547.         /**
  548.          * Get the FontMetrics of this object.
  549.          *
  550.          * @param f the Font
  551.          * @return the FontMetrics, if supported, the object; otherwise, null
  552.          * @see getFont
  553.          */
  554.         public FontMetrics getFontMetrics(Font f) {
  555.             return JWindow.this.getFontMetrics(f);
  556.         }
  557.  
  558.         /**
  559.          * Determine if the object is enabled.
  560.          *
  561.          * @return true if object is enabled; otherwise, false
  562.          */
  563.         public boolean isEnabled() {
  564.             return JWindow.this.isEnabled();
  565.         }
  566.  
  567.         /**
  568.          * Set the enabled state of the object.
  569.          *
  570.          * @param b if true, enables this object; otherwise, disables it 
  571.          */
  572.         public void setEnabled(boolean b) {
  573.             JWindow.this.setEnabled(b);
  574.         }
  575.         
  576.         /**
  577.          * Determine if the object is visible.  Note: this means that the
  578.          * object intends to be visible; however, it may not in fact be
  579.          * showing on the screen because one of the objects that this object
  580.          * is contained by is not visible.  To determine if an object is
  581.          * showing on the screen, use isShowing().
  582.          *
  583.          * @return true if object is visible; otherwise, false
  584.          */
  585.         public boolean isVisible() {
  586.             return JWindow.this.isVisible();
  587.         }
  588.  
  589.         /**
  590.          * Set the visible state of the object.
  591.          *
  592.          * @param b if true, shows this object; otherwise, hides it 
  593.          */
  594.         public void setVisible(boolean b) {
  595.             JWindow.this.setVisible(b);
  596.         }
  597.  
  598.         /**
  599.          * Determine if the object is showing.  This is determined by checking
  600.          * the visibility of the object and ancestors of the object.  Note: 
  601.          * this will return true even if the object is obscured by another 
  602.          * (for example, it happens to be underneath a menu that was pulled 
  603.          * down).
  604.          *
  605.          * @return true if object is showing; otherwise, false
  606.          */
  607.         public boolean isShowing() {
  608.             return JWindow.this.isShowing();
  609.         }
  610.  
  611.         /** 
  612.          * Checks whether the specified point is within this object's bounds,
  613.          * where the point's x and y coordinates are defined to be relative to 
  614.          * the coordinate system of the object. 
  615.          *
  616.          * @param p the Point relative to the coordinate system of the object
  617.          * @return true if object contains Point; otherwise false
  618.          */
  619.         public boolean contains(Point p) {
  620.             return JWindow.this.contains(p);
  621.         }
  622.     
  623.         /** 
  624.          * Returns the location of the object on the screen.
  625.          *
  626.          * @return location of object on screen -- can be null if this object
  627.          * is not on the screen
  628.          */
  629.         public Point getLocationOnScreen() {
  630.             return JWindow.this.getLocationOnScreen();
  631.         }
  632.  
  633.         /** 
  634.          * Gets the location of the object relative to the parent in the form 
  635.          * of a point specifying the object's top-left corner in the screen's 
  636.          * coordinate space.
  637.          *
  638.          * @return An instance of Point representing the top-left corner of 
  639.          * the objects's bounds in the coordinate space of the screen; null if
  640.          * this object or its parent are not on the screen
  641.          */
  642.         public Point getLocation() {
  643.             return JWindow.this.getLocation();
  644.         }
  645.  
  646.         /** 
  647.          * Sets the location of the object relative to the parent.
  648.      * 
  649.      * @param p the Point object specifying the location of the
  650.      *          object's upper left corner
  651.          */
  652.         public void setLocation(Point p) {
  653.             JWindow.this.setLocation(p);
  654.         }
  655.  
  656.         /** 
  657.          * Gets the bounds of this object in the form of a Rectangle object. 
  658.          * The bounds specify this object's width, height, and location
  659.          * relative to its parent. 
  660.          *
  661.          * @return A rectangle indicating this component's bounds; null if 
  662.          * this object is not on the screen.
  663.          */
  664.         public Rectangle getBounds() {
  665.             return JWindow.this.getBounds();
  666.         }
  667.  
  668.         /** 
  669.          * Sets the bounds of this object in the form of a Rectangle object. 
  670.          * The bounds specify this object's width, height, and location
  671.          * relative to its parent.
  672.          *      
  673.          * @param A rectangle indicating this component's bounds
  674.          */
  675.         public void setBounds(Rectangle r) {
  676.             JWindow.this.setBounds(r);
  677.         }
  678.  
  679.         /** 
  680.          * Returns the size of this object in the form of a Dimension object. 
  681.          * The height field of the Dimension object contains this objects's
  682.          * height, and the width field of the Dimension object contains this 
  683.          * object's width. 
  684.          *
  685.          * @return A Dimension object that indicates the size of this 
  686.          * component; null if this object is not on the screen
  687.          */
  688.         public Dimension getSize() {
  689.             return JWindow.this.getSize();
  690.         }
  691.  
  692.         /** 
  693.          * Resizes this object so that it has width width and height. 
  694.          *      
  695.          * @param d - The dimension specifying the new size of the object. 
  696.          */
  697.         public void setSize(Dimension d) {
  698.             JWindow.this.setSize(d);
  699.         }
  700.  
  701.         /**
  702.          * Returns the Accessible child, if one exists, contained at the local
  703.          * coordinate Point.
  704.          *
  705.          * @param p The point defining the top-left corner of the Accessible, 
  706.          * given in the coordinate space of the object's parent. 
  707.          * @return the Accessible, if it exists, at the specified location; 
  708.          * else null
  709.          */
  710.         public Accessible getAccessibleAt(Point p) {
  711.             return SwingUtilities.getAccessibleAt(JWindow.this,p);
  712.         }
  713.  
  714.         /**
  715.          * Returns whether this object can accept focus or not.
  716.          *
  717.          * @return true if object can accept focus; otherwise false
  718.          */
  719.         public boolean isFocusTraversable() {
  720.             return JWindow.this.isFocusTraversable();
  721.         }
  722.  
  723.         /**
  724.          * Requests focus for this object.
  725.          */
  726.         public void requestFocus() {
  727.             JWindow.this.requestFocus();
  728.         }
  729.  
  730.         /**
  731.          * Adds the specified focus listener to receive focus events from this 
  732.          * component. 
  733.          *
  734.          * @param l the focus listener
  735.          */
  736.         public void addFocusListener(FocusListener l) {
  737.             JWindow.this.addFocusListener(l);
  738.         }
  739.  
  740.         /**
  741.          * Removes the specified focus listener so it no longer receives focus 
  742.          * events from this component.
  743.          *
  744.          * @param l the focus listener
  745.          */
  746.         public void removeFocusListener(FocusListener l) {
  747.             JWindow.this.removeFocusListener(l);
  748.         }
  749.     } // inner class AccessibleJWindow
  750. }
  751.  
  752.